package com.jams.goodox.adapter;

import android.text.TextUtils;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.facebook.drawee.view.SimpleDraweeView;
import com.jams.goodox.R;
import com.jams.goodox.entity.MyActivityList;
import com.jams.library.fresco.FrescoUtil;

import java.util.List;

/**
 * Created by Jin on 2016/5/18.
 * Description 我的互动-我的报名  列表适配器
 */
public class MineInteractionChild3Adapter extends BaseQuickAdapter<MyActivityList.DataBean.ResultListBean> {

	public MineInteractionChild3Adapter(List<MyActivityList.DataBean.ResultListBean> list) {
		super(R.layout.mine_acvite_list_item, list);
	}

	@Override
	protected void convert(BaseViewHolder baseViewHolder,final MyActivityList.DataBean.ResultListBean bean) {
		baseViewHolder.setText(R.id.tx_content, bean.getEntime());
        baseViewHolder.setText(R.id.tx_status,bean.getApplyStatus());
		SimpleDraweeView imageView = baseViewHolder.getView(R.id.img_icon);
		imageView.setAspectRatio(2.17f);
		ImageView img=baseViewHolder.getView(R.id.img);
		img.setImageResource(bean.getState() == 3? R.mipmap.active_shade_gray : R.mipmap.active_shade_theme);
		FrescoUtil.loadNetUrl(imageView, TextUtils.isEmpty(bean.getActivityPic())?"www":bean.getActivityPic());
       
      
		//审核状态
		final  int checkStatus = bean.getApproveStatus();
		String status = "";
		int drawable = R.drawable.circle_btn_gray;
		switch (checkStatus){ 
            // 1 审核中/ 2 通过/ 3 未通过/ 4 已取消
			case 1:
				status = "审核中";
				drawable = R.drawable.circle_btn_blue;
				break;
			case 2:
				status = "通过";
				drawable = R.drawable.circle_btn_green;
				break;
			case 3:
				status = "未通过";
				drawable = R.drawable.circle_btn_red;
				break;
            case 4:
                status = "已取消";
                drawable = R.drawable.circle_btn_red;
                break;
			default:
				break;

		}
		baseViewHolder.setText(R.id.tx_status,status).setBackgroundRes(R.id.img_status,drawable);
	}
}
